
<!DOCTYPE html>
<html lang="en" class="no-js">

<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="description" content="">
	<meta name="keywords" content="">

	<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
	<link rel="stylesheet" href="/Public/static/css/amazeui.min.css">
	<link rel="stylesheet" href="/Public/static/css/app.css">
	<link rel="stylesheet" href="/Public/static/css/all.css">
	<title>个人中心</title>

	<link rel="stylesheet" href="/Public/static/css/common.css">
	<link rel="stylesheet" href="/Public/static/css/mine.css">

	<style>
		.head_input {
			position: absolute;
			width: 100%;
			height: 100%;
			top: 0;
			opacity: 0;
		}

		.head_height img {
			width: 100%;
			height: 100%;
		}
	</style>

</head>

<body id="wd">


	<div class="wd-head">
		<div class="comm_top_nav" style="color: rgb(39, 37, 40);margin: 0px;background: none;" data-am-sticky="">
			<b>个人中心</b>
		</div>
		<div class="mine_top_bg">
<php>
$user = getUserInfo();
</php>
		</div>
		<div class="mine_top_div"></div>
		<div class="mine_top">
			<div class="am-g">
				<div class="am-u-sm-4  am-u-sm-offset-1 head_height">
					<img class="am-circle am-img-responsive head" src="/Public/static/picture/default_head.png">

				</div>
				<div class="am-u-sm-7" style="line-height: 200%;color: rgb(39, 37, 40);">
					<b>账号</b>
					<br>
					<empty name="user">
										<a href="{:U('Index/login')}">登录 / 注册</a>
											<else />
												<span class="f_number">{$user.telnum}</span>
											</empty>
				</div>
			</div>

			<div class="am-g" style="overflow: hidden;line-height: 40px;padding: 10px 0;">
				<div class="am-u-sm-6">
					<a href="{:U('Repay/index')}" style="color: rgb(39, 37, 40);">
						<div class="left_li_div">
							<img class="left_li_img am-img-responsive menu-icon"
								src="/Public/static/picture/yhq.png">
							<div class="left_li_txt">我的钱包</div>
							<div class="clear"></div>
						</div>
					</a>
				</div>
				<div class="am-u-sm-6">
					<a href="{:U('Page/setting')}" style="color: rgb(39, 37, 40);">

						<div class="left_li_div">
							<img class="left_li_img am-img-responsive menu-icon"
								src="/Public/static/picture/sz.png">
							<div class="left_li_txt">设置</div>
							<div class="clear"></div>
						</div>
					</a>
				</div>

			</div>
		</div>


	</div>

	<div class="am-g tx-title">
		<div class="am-u-sm-1">
			<div class="point"></div>
		</div>
		<a href="{:U('Repay/index')}" style="color: #000;">
		<div class="am-u-sm-9">
			可提现金额:
			<b class="f_number quota">
			{$user.qianbao|number_format=2}
					
			</b>
			元
		</div>
		</a>
		<div class="am-u-sm-2" style="text-align: right;"><i class="am-icon-angle-right am-icon-fw"></i></div>
	</div>

	<div class="menu-list">
		<div class="am-g">
			<a href="{:U("Info/index")}">
				<div class="am-u-sm-10">
					<img class="am-circle am-img-responsive menu-icon" src="/Public/static/picture/wdzl.png">

					我的资料
				</div>
				<div class="am-u-sm-2" style="text-align: right;"><i class="am-icon-angle-right am-icon-fw"></i></div>
			</a>
		</div>
		<div class="am-g">
			<a href="{:U('Loan/viewContracts')}">
				<div class="am-u-sm-10">
					<img class="am-circle am-img-responsive menu-icon" src="/Public/static/picture/yzm.png">
					我的合同
				</div>
				<div class="am-u-sm-2" style="text-align: right;"><i class="am-icon-angle-right am-icon-fw"></i></div>
			</a>
		</div>
		
		<div class="am-g">
			<a href="{:U("Repay/order")}">
				<div class="am-u-sm-10">
					<img class="am-circle am-img-responsive menu-icon" src="/Public/static/picture/wdjk.png">

					我的借款
				</div>
				<div class="am-u-sm-2" style="text-align: right;"><i class="am-icon-angle-right am-icon-fw"></i></div>
			</a>
		</div>
		<div class="am-g">
			<a href="{:U("Repay/viewbill")}">
				<div class="am-u-sm-10">
					<img class="am-circle am-img-responsive menu-icon" src="/Public/static/picture/wdhk.png">

					我的还款
				</div>
				<div class="am-u-sm-2" style="text-align: right;"><i class="am-icon-angle-right am-icon-fw"></i></div>
			</a>
		</div>
	</div>

	<div class="system-list">
		<div class="am-g">
			<a href="{:U("Page/evaluation")}">
				<div class="am-u-sm-10">
					<img class="am-circle am-img-responsive menu-icon" src="/Public/static/picture/fxcp.png">

					风险测评
				</div>
				<div class="am-u-sm-2" style="text-align: right;"><i class="am-icon-angle-right am-icon-fw"></i></div>
			</a>
		</div>
		 <php>$services_user= empty(C('services_user'))?'':htmlspecialchars_decode(htmlspecialchars_decode(C('services_user')));</php>
		<div class="am-g" >
			<a href="{$services_user}">
				<div class="am-u-sm-10">
					<img class="am-circle am-img-responsive menu-icon" src="/Public/static/picture/wdxx.png">

					我的消息
				</div>
				<div class="am-u-sm-2" style="text-align: right;"><i class="am-icon-angle-right am-icon-fw"></i></div>
			</a>
		</div>
		<div class="am-g">
		   
					
			<a href="{:U("Page/problem")}">
				<div class="am-u-sm-10">
					<img class="am-circle am-img-responsive menu-icon" src="/Public/static/picture/cjwt.png">

					常见问题
				</div>
				<div class="am-u-sm-2" style="text-align: right;"><i class="am-icon-angle-right am-icon-fw"></i></div>
			</a>
		</div>
	<!--	<div class="am-g">
			<a href="/index.php?m=User&a=question">
				<div class="am-u-sm-10">
					<img class="am-circle am-img-responsive menu-icon" src="/Public/static/picture/cjwt.png">

					常见问题
				</div>
				<div class="am-u-sm-2" style="text-align: right;"><i class="am-icon-angle-right am-icon-fw"></i></div>
			</a>
		</div>-->
	</div>

	<div class="message">
		<p></p>
	</div> 
<include file="Public/foot_index" />
	<!--<div id="kefu"></div>-->
	<script type="text/javascript">
		document.documentElement.addEventListener('touchmove', function (event) {
			if (event.touches.length > 1) {
				event.preventDefault();
			}
		}, false);
	</script>

	<script src="/Public/static/js/jquery3.2.min.js"></script>
	<!--<![endif]-->
	<script src="/Public/static/js/amazeui.min.js"></script>

	<script>
		var upload_type,
			width = $(window).width(),
			timer,
			msg
			;

		$("#wd #bm-nav .nva_wd a img").attr('src', '/Public/static/picture/4-2.png');

		$(".head_height").height($(".head_height").width());

		$(".left_li_div").css("padding-left", $('.left_li_div').width() / 2 - ($(".left_li_img").width() + $(".left_li_txt").width()) / 2);
		$(window).resize(function () {
			$(".head_height").height($(".head_height").width());
			$(".left_li_div").css("padding-left", $('.left_li_div').width() / 2 - ($(".left_li_img").width() + $(".left_li_txt").width()) / 2);
		});
		// 弹窗
		// 倒计时
		function myTimer() {
			var sec = 3;
			clearInterval(timer);
			timer = setInterval(function () {
				console.log(sec--);
				if (sec == 1) {
					$(".message").addClass("m-hide");
					$(".message").removeClass("m-show");
				}
				if (sec == 0) {
					$(".message").hide();
					$(".message").removeClass("m-hide");
					clearInterval(timer);
				}
			}, 1000);
		}

		// 弹窗内容
		function message(data) {
			msg = $(".message p").html(data);
			$(".message").addClass("m-show");
			$(".message").show();

			myTimer();

		}

		// 初始化弹窗
		function mesg_default() {
			msg = '';
			$(".message").hide();
			$(".message").removeClass("m-show");
			$(".message").removeClass("m-hide");
		}


		//图像上传
		$('.head_input').change(function () {
			// upload_type = $(this).data("type");
			var file = this.files[0];
			var iname = $(this).val();
			//后台传值需要
			var size = file.size / 1024;
			//获取文件大小 用来判断是否超过多少kb
			var URL = window.URL || window.webkitURL;
			var blob = URL.createObjectURL(file);
			var image = new Image();
			image.src = blob;
			//console.log(blob);
			image.onload = function () {
				getUrlBase64(blob, size);
			};
			//将图片转为base64
			function getUrlBase64(url, size) {
				var canvas = document.createElement("canvas");   //创建canvas DOM元素
				var ctx = canvas.getContext("2d");
				var img = new Image;
				img.crossOrigin = 'Anonymous';
				img.src = url;
				img.onload = function () {
					var w = this.width, h = this.height, scale = w / h;
					w = w > 600 ? 600 : w;
					h = w / scale;
					canvas.height = h; //指定画板的高度,自定义
					canvas.width = w; //指定画板的宽度，自定义
					ctx.drawImage(img, 0, 0, w, h); //参数可自定义
					if (size > 200) {
						//判断 如果图片大图200kb就压缩 否则就不压缩
						var dataURL = canvas.toDataURL("image/jpeg", 0.9);
						//压缩主要代码 第二个参数表示压缩比例，指为1.0时表示不压缩
					} else {
						var dataURL = canvas.toDataURL("image/jpeg");
					}
					//显示预览
					// var img_div = $('#'+upload_type).parent(".upload_box");

					// img_div.css({"background":"url('"+dataURL+"')","background-repeat": "no-repeat","background-size": "auto 100%","background-position":" center center"});
					var oFormData = new FormData();
					// FormData()方法向后台传值
					// oFormData.append("uId",upload_type);

					oFormData.append('base64', dataURL);

					$.ajax({
						type: 'post',
						url: 'uphead',
						data: oFormData,
						cache: false,  // 不缓存
						contentType: false, // jQuery不要去处理发送的数据
						processData: false, // jQuery不要去设置Content-Type请求头
						success: function (data) {
							console.log(data.image_url);
							// var obj = JSON.parse(data);
							// $('#sfz'+upload_type).val(data.image_url);

							$('.head').attr('src', data.image_url);

							mesg_default();

							msg = data.mesg;

							message(msg);

						},
						error: function (err) {
							console.log(err);
						}
					});

					canvas = null;
				};
			}



		});




	</script>

   




</body>

</html>